 $(document).ready(function() {
			
                $("#submitLogin").click (function() {
			
                    var username = $("#username").val();
                    var password = $("#password").val();
					var dataString = "username="+ username + "&password=" + password;

                    $.ajax({  //Make the Ajax Request
                        type: "POST",  
                        url: "login.php",  //file name
                        data: dataString,  //data
                        success: function(server_response){  
						
                            $("#login").ajaxComplete(function(event, request){ 
								if (server_response == '0')//if ajax_check_username.php return value "0"
                                { 
									document.getElementById("LoginError").style.display='none';
                                    $("#login").html('Welcome, ' + username + ".<br><a href='HomePage.php?logout'><b>Logout<b></a>");
                                }  
                                else  if (server_response == '1')//if it returns "1"
                                {  
                                    document.getElementById("PasswordError").style.display='block';
                                } 
								else  if (server_response == '2')//if it returns "1"
                                {  
                                    document.getElementById("LoginError").style.display='block';
                                } 
								
                            });
                        } 
   
                    }); 
					return false; 
                });
            });